package com.itlong.cloud.app.resource;

import com.itlong.cloud.POJO.VO.app.AppUserCacheVO;
import com.itlong.cloud.POJO.VO.app.robot.AppRobotLoginCacheVO;
import com.itlong.cloud.app.service.IAppRobotLoginCacheService;
import com.itlong.cloud.app.service.IAppUserInfoCacheService;
import com.itlong.cloud.user.app.IAppUserInfoCacheServiceClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *      APP用户缓存信息业务暴露接口实现类
 * </desc>
 *
 * @createDate 2017/10/19
 */
@RestController
public class AppUserInfoServiceResource implements IAppUserInfoCacheServiceClient{
    @Autowired
    IAppUserInfoCacheService iAppUserInfoCacheService;

    @Autowired
    private IAppRobotLoginCacheService iAppRobotLoginCacheService;

    /**
     * <desc>
     *      从缓存获取用户信息
     * </desc>
     *
     * @param token
     * @return
     * @author Jiaqi.X
     * @createDate 2017/10/19
     */
    @Override
    @RequestMapping(path = "app/user/retrieve")
    public AppUserCacheVO retrieve(@RequestParam("token")String token){
        return iAppUserInfoCacheService.retrieve(token);
    }

    /**
     * <desc>
     *      获取机器人登录缓存
     * </desc>
     *
     * @param token 机器人登录token
     * @return 机器人登录缓存
     * @author wangzhi
     * @createDate 2018/10/15
     */
    @Override
    @PostMapping(path = "robot/user/getRobotLoginCache")
    public AppRobotLoginCacheVO getRobotLoginCache(@RequestParam("token") String token) {
        return iAppRobotLoginCacheService.getRobotLoginCache(token);
    }
}
